Skip to content

fixed some clippy warnings in compiletest #42896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 1, 2017

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented Jun 25, 2017

This is mainly readability stuff. Whenever the clone_ref lint asked me to clone the dereferenced object, I removed the .clone() instead, relying on the fact that it has worked so far and the immutable borrow ensures that the value won't change.

@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

let major: isize = version_string.parse().ok().expect(&error_string);
return major;
let major: isize = version_string.parse().expect(&error_string);
major
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be just one line, there's no need for the variable here. I guess it does indicate what we're getting from the version, but AIUI that's not actually important -- the isize is mostly opaque.

As a side note, which is out of scope for this PR, why is this an isize? Can the version number be negative? u32 or u64 would seem to make more sense...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I did not look at that code too closely. We had clippy ignore bindings with given type because we were getting some false positives around it. However, I agree, this should be one line. I'm not going to change APIs here...

@Mark-Simulacrum Mark-Simulacrum added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 25, 2017
@alexcrichton
Copy link
Member

Looks like tidy may be failing as well?

@llogiq
Copy link
Contributor Author

llogiq commented Jun 27, 2017

Ouch, one change brought it to 101 chars per line. Fixed.

@kennytm
Copy link
Member

kennytm commented Jun 27, 2017

[00:34:05]    Compiling compiletest v0.0.0 (file:///checkout/src/tools/compiletest)
[00:34:05] error[E0308]: mismatched types
[00:34:05]    --> /checkout/src/tools/compiletest/src/header.rs:549:59
[00:34:05]     |
[00:34:05] 549 |   pub fn lldb_version_to_int(version_string: &str) -> isize {
[00:34:05]     |  ___________________________________________________________^
[00:34:05] 550 | |     let error_string = format!("Encountered LLDB version string with unexpected format: {}",
[00:34:05] 551 | |                                version_string);
[00:34:05] 552 | |     version_string.parse().expect(&error_string);
[00:34:05] 553 | | }
[00:34:05]     | |_^ expected isize, found ()
[00:34:05]     |
[00:34:05]     = note: expected type `isize`
[00:34:05]                found type `()`
[00:34:05] help: consider removing this semicolon:
[00:34:05]    --> /checkout/src/tools/compiletest/src/header.rs:552:49
[00:34:05]     |
[00:34:05] 552 |     version_string.parse().expect(&error_string);
[00:34:05]     |                                                 ^
[00:34:05] 
[00:34:06] error: aborting due to previous error(s)
[00:34:06] 
[00:34:06] error: Could not compile `compiletest`.

@arielb1 arielb1 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 27, 2017
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Jun 30, 2017

📌 Commit 7be171d has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Jul 1, 2017

⌛ Testing commit 7be171d with merge 4a92ae2...

bors added a commit that referenced this pull request Jul 1, 2017
fixed some clippy warnings in compiletest

This is mainly readability stuff. Whenever the `clone_ref` lint asked me to clone the dereferenced object, I removed the `.clone()` instead, relying on the fact that it has worked so far and the immutable borrow ensures that the value won't change.
@bors
Copy link
Collaborator

bors commented Jul 1, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 4a92ae2 to master...

@bors bors merged commit 7be171d into rust-lang:master Jul 1, 2017
@llogiq llogiq deleted the clippy_compiletest branch July 1, 2017 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants